
<template>
  <div>
    <MyHeader :title="title" :backgroundColor="backgroundColor"></MyHeader>
    <div class="main">
      <MyGoods v-for="item in list" :key="item.id" :list="item"></MyGoods>
    </div>
    <MyFooter :list="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyFooter from "./components/MyFooter";
import MyGoods from "./components/MyGoods";
export default {
  // MyHeader组件 MyFooter组件 MyGoods组件 - 商品 MyCount组件
  components: {
    MyHeader,
    MyFooter,
    MyGoods,
  },
  data() {
    return {
      title: "购物车案例",
      backgroundColor: "#f0f",
      list: [],
    };
  },
  created() {
    this.$http({
      url: "api/cart",
    }).then((res) => (this.list = res.data.list));
  },
};
</script>

<style scoped>
.main {
  padding: 50px;
}
</style>